<?php

class LabelRenderer {

    private static $LABEL_COUNT = 0;

    public static function renderLabel(CamposFormularios $question) {
        $render = "";
        self::$LABEL_COUNT++;
        $count = self::$LABEL_COUNT;
        $type = ucwords(strtolower($question->getTipo()));
        if ($type != "Hidden") {
            $render = "<label for='_{$question->getId()}'>
                {$question->getNombreCampo()}
            </label>";
        }
        
        return $render;
    }

}

function smarty_function_render_label($params,
        Smarty_Internal_Template $template) {
    
    $question = $params["q"];
    $render = "";

    if ($question instanceof CamposFormularios) {
       $render = LabelRenderer::renderLabel($question);
    }

    return $render;
}

?>
